package com.commons.test;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.IntStream;

public class Go {

    public static void main(String[] args) {
        List<Person> persons=new ArrayList<>();

        IntStream.range(1,4).forEach(i->persons.add(new Person("person"+i)));

        persons.forEach(f->IntStream.range(1,4).forEach(i->f.bar.add(new Bar("bar"+i+" "+f.getName()))));



        persons.stream().flatMap(f->f.bar.stream())
                .forEach(b-> System.out.println(b.name));
    }
}
